package com.sqsf.mapper;

import com.sqsf.javabean.Role;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

public interface RoleMapper {
    @Select("select * from role")
    List<Role> selectAll();
    @Insert("insert into role (roleName,roleDesc)values(#{roleName},#{roleDesc})")
    int insert(Role role);
    @Delete("delete from role where id=#{id}")
    int deleteById(int id);
    @Delete("delete from role_permission where roleId=#{rid}")
    int deleteByRid(int rid);

    int deleteByList(ArrayList<Integer> ids);
    int deleteR_PByList(ArrayList<Integer> ids);

    Role selectR_PById(int id);

    @Update("update role set roleName=#{roleName},roleDesc=#{roleDesc} where id=#{id}")
    int updateById(Role role);

    @Delete("delete from role_permission where roleId=#{id}")
    int deleteR_PById(int id);

    int insertR_P(@Param("rid") Integer rid, @Param("ids") List<Integer> ids);
}